package com.mediatek.factorymode;

import android.app.Activity;
import android.app.ProgressDialog;
import android.bluetooth.BluetoothAdapter;
import android.bluetooth.BluetoothDevice;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.SharedPreferences;
import android.net.wifi.ScanResult;
import android.os.Bundle;
import android.os.Environment;
import android.os.Handler;
import android.os.HandlerThread;
import android.os.Looper;
import android.os.Message;
import com.mediatek.factorymode.wifi.WiFiTools;
import java.util.List;
import java.util.ArrayList;
import android.content.res.Resources;

public class AutoTest extends Activity
{
  SharedPreferences mSp;
  public ArrayList<String> autoList = new ArrayList();
  public Utils utils = new Utils();
  public Resources res;
  public int autoListSize;
  public int a = 0;
  public int b = 1;


  protected void onActivityResult(int paramInt1, int paramInt2, Intent paramIntent)
  {
    System.gc();
      if(a == paramInt1){
        if(b < autoListSize){
           startTest(b);
           paramInt1 = b;
           a++;
           b++;
         }else{
           finish(); 
         }
      }
    }
 
  public void onCreate(Bundle paramBundle)
  {
    super.onCreate(paramBundle);
    setContentView(R.layout.alltest);
    res = getResources();
    autoList = utils.getListArray(res);
    autoListSize = autoList.size();
    SharedPreferences localSharedPreferences = getSharedPreferences("FactoryMode", 0);
    this.mSp = localSharedPreferences;

    startTest(0);
  }

  private void startTest(int i){
    if(i >= autoListSize){
      return;
    }
    Intent localIntent = new Intent();
    localIntent.setClassName(this, utils.getTestPkgName(res,autoList.get(i)));
    startActivityForResult(localIntent, i);
  }

  public void onDestroy()
  {
    super.onDestroy();
  }
}
